package com.deere.model;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToOne;
import javax.persistence.Table;

/**
 * 零件报废表
 * 
 * @author zhaohongxing
 * 
 */
@Entity
@Table(name = "SCRAP")
public class Scrap extends GenericModel {

	/*
	 * 主键
	 */
	private long id;

	/*
	 * 生产工单唯一标识
	 */
	private long moId;
	/*
	 * 此次报废的数量
	 */
	private int qty;
	/*
	 * 对应的生产工单
	 */
	private WorkOrder workOrder;

	@Id
	@GeneratedValue(strategy=GenerationType.AUTO)
	public long getId() {
		return id;
	}

	public void setId(long id) {
		this.id = id;
	}
	
	@OneToOne(fetch=FetchType.EAGER)
	@JoinColumn(name="MO_ID",insertable=false,updatable=false)
	public WorkOrder getWorkOrder() {
		return workOrder;
	}

	public void setWorkOrder(WorkOrder workOrder) {
		this.workOrder = workOrder;
	}

	@Column(name="MO_ID")
	public long getMoId() {
		return moId;
	}

	public void setMoId(long moId) {
		this.moId = moId;
	}

	public int getQty() {
		return qty;
	}

	public void setQty(int qty) {
		this.qty = qty;
	}

}
